﻿using RabbitMQ.Client;
using System;
using System.Text;

namespace PublishLoggerApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var channel = Common.RabbitMQ.GetChannel();

            //交换机
            channel.ExchangeDeclare("myexchange", ExchangeType.Direct, true, false, null);

            //队列 队列名称,是否持久化,是否排外,
            //channel.QueueDeclare("mytest", true, false, false, null);

            //绑定交换机
            //channel.QueueBind("mytest", "myexchange", "mytest", default);

            for (int i = 0; i < 100; i++)
            {
                var leavl = i % 10 == 0 ? "info" : "error";
                channel.BasicPublish("myexchange", leavl, null, Encoding.UTF8.GetBytes($"你好{i}"));
            }

            Console.ReadKey();
        }
    }
}
